import { getTickerLogin } from '@/api/user'
import * as types from './mutation-types'
import { setStore } from "../utils/mUtils";

export const getTicker = async function ({ commit }, { ticket }) {
  const res = await getTickerLogin({ ticket }).then(res => res).catch(err => err)
  // console.log(res);
  // console.log(222222222222);
  // console.log(typeof (res));
  
  if (typeof (res) == 'object') {
   
    // console.log(res.data);
    // console.log(333333);
    
    if (res.data.code == '200') {
      let result = res.data.data
      setStore('sessionId', result.sessionId)
      commit(types.SET_USERINFO, result)
    } 
    // console.log(4444444444444);
    return res
  }else{
    return res
  }

  
}
export const getWagePay= function ({ commit }, data) {
  commit(types.SET_WAGEPAY, data)
}
export const setDataCenterAttendance = function ({ commit,state }, data) {
  // console.log(data);
  // let result
  // if(state.dataCenterAttendance.orgAttendanceVOList.length){
  //   state.dataCenterAttendance.orgAttendanceVOList.splice(0,1)
  //   result = state.dataCenterAttendance
  // }else{
  //   result = data
  // }
  // console.log(result);
  commit('setDataCenterAttendance', data)
}
